package com.example.server.controller;


import com.example.server.pojo.MyMenu;
import com.example.server.pojo.RespBean;
import com.example.server.service.MyMenuService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/api")
public class MyMenuCtl {
    @Autowired
    private MyMenuService myMenuService;

    @ApiOperation(value = "查询所有菜单")
    @GetMapping("/allMenu")
    public RespBean allMenu(){
        List<MyMenu> result = myMenuService.allMenu();
        log.info("-----结果："+result);

        if (result != null){
            return new RespBean(200,"success",result);
        }else {
            return new RespBean(402,"获取菜单失败",null);
        }
    }
}
